############# ########### ####### ##### ### ##
#
# Copyright (C) 2010 The Hursk Group, LLC
#
# This program is free software: you can redistribute it and/or modify 
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (See file named COPYING).  If not, see 
# <http://www.gnu.org/licenses/>.
# 
############# ########### ####### ##### ### ##

#!/bin/bash
#
#
# full relative to this script path to dir containing system data to be assessed
base_url=/path/to/
# path to errata html files
#errata_store_dir=redhat_9/


for host_name in `ls $base_url`
do
	cat $base_url$host_name/showrevp.out | cut -f2 -d" " | sort -u > ./poo_patch_list
	for sec_patch in `cat solaris_8_sec_patch`
	do	
		sec_patch_parent=`echo $sec_patch | cut -f1 -d"-"`
		sec_patch_child=`echo $sec_patch | cut -f2 -d"-"`
		
		for patch_hit in `grep $sec_patch_parent ./poo_patch_list`
		do
			if [ "$patch_hit" ]; then
				patch_hit_child=`echo $patch_hit | cut -f2 -d"-"`
				test_res=`echo test,$sec_patch_child,$patch_hit_child`
				if [ "$patch_hit_child" -lt "$sec_patch_child" ]; then
					md5_results=`echo $sec_patch | md5sum | cut -f1 -d" "`
					results=`echo $host_name,$patch_hit,$sec_patch_parent-$sec_patch_child,$md5_results`
				fi
			fi
		done
		
		if [ "$results" ]; then
			echo $results
		fi
		test_res=
		results=
		
		
		
	done
	rm poo_patch_list
done